﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using LINQtoSQLDataProvider;

namespace Dragon.Prototype1.Service
{

    public class DataDictionaryService
    {
        static WMSDataContext shareddb;
 
        public static void DisposeDataContext()
        {
            if (shareddb!=null)
            {
                shareddb.Dispose();
            }
        }

        public static DataDictionary GetParentEntry(string typeCode)
        {
            shareddb=new WMSDataContext();
            DataDictionary result = shareddb.DataDictionaries.Single(d => d.DictionaryCode.ToLower()==typeCode.ToLower()
                && d.ParentKey==null);
            return result;
        }
    }
}
